<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model app\models\GkyQyhMenu */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="gky-qyh-menu-form">
    <div class="panel panel-default">
        <div class="panel-heading text-center" style="background: #003eff;color:white">gky-qyh-menu</div>
        <div class="panel-body">
            <?php $form = ActiveForm::begin([
                'options' => ['class' => 'form-horizontal form-group'],
                'fieldConfig' => [
                    'template' => "{label}<div class=\"col-lg-10\">{input}</div>",
                    'labelOptions' => ['class' => 'col-lg-2 control-label'],
                ]
            ]); ?>

            <div class="col-lg-6">
                <?= $form->field($model, 'app_id')->textInput() ?>
            </div>
            <div class="col-lg-6">
                <?php
                $menus = \app\models\GkyQyhMenu::findAll(['pid'=>'0']);
                $listData = [['id'=>'0','name'=>'无']];
                $listData = array_merge($listData,$menus);
                echo $form->field($model, 'pid')
                    ->dropDownList(
                        ArrayHelper::map($listData,'id','name'),
                        ['prompt' => '请选择一级菜单']
                    )
                    ->label('一级菜单')
                ?>
            </div>
            <div class="col-lg-6">
                <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-6">
                <?php
                $menuTypes = \app\models\GkyWeMenuType::find()->all();
                echo $form->field($model, 'type')
                    ->dropDownList(
                        ArrayHelper::map($menuTypes,'id','name'),
                        ['prompt' => '请选择类型']
                    )
                    ->label('类型')
                ?>

            </div>
            <div class="col-lg-6">
                <?= $form->field($model, 'key')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-6">
                <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-6">
                <?= $form->field($model, 'sort')
                    ->dropDownList(
                        [1,2,3,4,5],
                        ['prompt' => '请选择排序'])
                    ->label('排序号')
                ?>
            </div>
            <div class="col-lg-6">
                <?= $form->field($model, 'isSet')->textInput() ?>
            </div>
            <div class="form-group">
                <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success col-lg-offset-5 col-xs-offset-5 col-sm-offset-5 col-md-offset-5' : 'btn btn-primary col-lg-offset-5 col-xs-offset-5 col-sm-offset-5 col-md-offset-5']) ?>
                <?= Html::a('Return', ['index'], ['class' => 'btn btn-primary']) ?>
            </div>

            <?php ActiveForm::end(); ?>
        </div>
    </div>

</div>
